$(function(){
// For demo only
	$('.extension, .emoticon').tipsy({gravity:'s', title: 'class'}); // Show extensions classes
	
	// Top scroll
	$().UItoTop();
	
	// Main navigation
	$('.nav-main-subnav').adminMenu(); // Custom plugin for navigation
	
	// jQuery Tipsy
	$('.tooltip, .loading').tipsy({gravity:'s', fade:true}); // Tooltip Gravity Orientation: n | w | e | s
	$('.tooltip-wide').tipsy({gravity:'e', fade:true}); // Tooltip Gravity Orientation: n | w | e | s
	
	// jQuery dataTables
	//$('.datatable').dataTable({ 'sPaginationType':'full_numbers' });
	
// Targeting Opera 11 and older Opera browsers
	if (window.opera && window.opera.version() < 12) {
		document.documentElement.className += ' opera11';
	};
	// Content box tabs and sidetabs
	$('.tab').hide(); // Hide the content divs
	$('.default-tab').show(); // Show the div with class 'default-tab'
	$('.tab-switch a.default-tab').addClass('current'); // Set the class of the default tab link to 'current'

	// Note: Tab ID have to be 'tabN', where N is number, or you would have to change regular expression to get hash working. Same applies for sidetabs.
	// 		 For more info about regular expressions please visit www.regular-expressions.info

	if(window.location.hash && window.location.hash.match(/^#tab\d+$/)) { // Check for tab Hash ID, if exist opens corresponding tab
		var tabID = window.location.hash; // Set variable tabID to the value of URL Hash
		
		$('.tab-switch a[href='+tabID+']').addClass('current').parent().siblings().find('a').removeClass('current'); // Find corresponding link and set is as current
		$('div'+tabID).parent().find('.tab').hide(); // Hide all content divs
		$('div'+tabID).show(); // Show the content div with the id equal to the id of URL Hash
		$('div'+tabID).find('.visualize').trigger('visualizeRefresh');; // Refresh jQuery Visualize
	} 
	
	$('.tab-switch a').click(
		function() { 
			var tab = $(this).attr('href'); // Set variable 'tab' to the value of href of clicked tab
			$(this).parent().siblings().find('a').removeClass('current'); // Remove 'current' class from all tabs
			$(this).addClass('current'); // Add class 'current' to clicked tab
			$(tab).siblings('.tab').hide(); // Hide all content divs
			$(tab).show(); // Show the content div with the id equal to the id of clicked tab
			$(tab).find('.visualize').trigger('visualizeRefresh'); // Refresh jQuery Visualize
			return false;
		}
	);	
	
	// Progress bar animation
	$('.progress-bar').each(function() {
		var progress = $(this).children().width();
		$(this).children().css({ 'width':0 }).animate({width:progress},3000);
	});
});


    function dataLoaded()
        {
           $(".loading-notification").hide();
        }